package com.jinxin.platform.cdfaceacs.controller;

import com.jinxin.platform.base.common.pojo.JsonResult;
import com.jinxin.platform.cdfaceacs.pojo.form.RecordPageForm;
import com.jinxin.platform.cdfaceacs.service.CdattendancerecordRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Date;

/**
 * Date: 2021-04-23
 * Author: yangjie
 * desc:
 **/
@Api(tags = "考勤记录接口")
@RestController
@RequestMapping(value = "/attendanceRecord/record")
public class RecordController {
    @Resource
    CdattendancerecordRecordService recordService;

    @ApiOperation(value = "获取所有的考勤记录")
    @PostMapping(value = "/pageList")
    public JsonResult pageList(@RequestBody RecordPageForm pageForm) {
        if (pageForm.getDate() == null) {
            pageForm.setDate(new Date());
        }
        return JsonResult.ok(recordService.webPageRecordList(pageForm));
    }

    @ApiOperation(value = "获取用户月份考勤记录")
    @PostMapping(value = "/pageUserByMonthList")
    public JsonResult pageUserByMonthList(@RequestBody RecordPageForm pageForm) {
      /*  if (pageForm.getDate() == null) {
            pageForm.setDate(new Date());
        }*/
        return JsonResult.ok(recordService.pageUserByMonthList(pageForm));
    }

}
